<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/jsp/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title><#noparse>${appname}</#noparse></title>
<%@ include file="/WEB-INF/view/jsp/common/css_js_ace.jsp"%>
<script type="text/javascript">
function deleteById(id){
	ui.confirm('确认删除?',function(){
		$.ajax({
			   type: "POST",
			   dataType:"json",
			   cache: false,
			   url: _ctx + "/${moduleUri}/${beanUri}_delete/"+id,
			   success: function(resp){
				   if(resp.success == '1'){
					   ui.msg(resp.msg, 1);
					   ui.go(_ctx + "/${moduleUri}/${beanUri}_list");
				   }else{
					   ui.msg(resp.msg, 0);
				   }
			   },
			   error:function(){
				   ui.msg('信息加载错误', 0);
			   }
		});
	});	
}

function deleteByBatch(){
	var isSlected = checkAll.isChecked();
	if(!isSlected){
		ui.msg('请至少选择一条要删除的记录!');
		return;
	}
	var ids = checkAll.getIdsAsArr();
	ui.confirm('确认删除?',function(){
		$.ajax({
			   type: "POST",
			   dataType:"json",
			   cache: false,
			   url: _ctx + "/${moduleUri}/${beanUri}_deletes",
			   traditional: true,
			   data:{ids:ids},
			   success: function(resp){
				   if(resp.success == '1'){
					   ui.msg(resp.msg, 1);
					   ui.go(_ctx + "/${moduleUri}/${beanUri}_list");
				   }else{
					   ui.msg(resp.msg, 0);
				   }
			   },
			   error:function(){
				   ui.msg('信息加载错误', 0);
			   }
		});
	}); 
}
</script>
</head>
<body>
<%@ include file="/WEB-INF/view/jsp/common/admin_topbar.jsp"%>
<div class="main-container" id="main-container">
	<div class="main-container-inner">
		<%@ include file="/WEB-INF/view/jsp/common/admin_sidebar.jsp"%>
		<div class="main-content">
			<div class="breadcrumbs" id="breadcrumbs">
				<ul class="breadcrumb">
					<li>
						<i class="icon-home home-icon"></i>
						<a href="#">首页</a>
					</li>

					<li class="active">控制台</li>
				</ul>
				<!--
				<div class="nav-search" id="nav-search">
					<form class="form-search">
						<span class="input-icon">
							<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
							<i class="icon-search nav-search-icon"></i>
						</span>
					</form>
				</div>
				-->
			</div>

			<div class="page-content">
				<div class="row">
					<div class="col-xs-12">
						<div class="widget-box">
							<div class="widget-header widget-header-flat">
								<h5 class="smaller lighter">
									&nbsp;
								</h5>
								<div class="widget-toolbar no-border">
									<a class="btn btn-primary btn-xs" href="<#noparse>${ctx}</#noparse>/${moduleUri}/${beanUri}_form"><i class="icon-plus-sign"></i> 新增&nbsp;</a>
									<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="deleteByBatch()"><i class="icon-trash"></i> 批量删除&nbsp;</a>
								</div>
							</div>

							<div class="widget-body">
								<div class="widget-main">
									<form id="mainForm" class="form-search" action="<#noparse>${ctx}</#noparse>/${moduleUri}/${beanUri}_list" method="post">
										<input type="hidden" name="pageNo" id="pageNo" value="<#noparse>${page.pageNumber}</#noparse>"/>
										<input type="hidden" name="orderBy" id="orderBy" value="<#noparse>${page.orderBy}</#noparse>"/>
										<input type="hidden" name="order" id="order" value="<#noparse>${page.order}</#noparse>"/>
										<div class="row mg-top12">
										<#list viewColList as vo>
										<#if vo.search>
											<div class="col-xs-4">
												<div class="input-group">
													<span class="input-group-addon">${vo.nameCN}</span>
													<input class="form-control" type="text" name="${vo.name}" value="<#noparse>${param.</#noparse>${vo.name}}"/>
												</div>
											</div>
										</#if>
										</#list>
											<div class="col-xs-4">
												<div class="input-group">
													<span class="input-group-btn">
														<button type="submit" class="btn btn-purple btn-sm">
															<i class="icon-search icon-on-right bigger-110"></i>
															搜索
														</button>
													</span>
												</div>
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
						
						<div class="hr hr12 hr-dotted"></div>
					
						<div class="table-responsive">
							<table id="sample-table-1" class="table table-striped table-bordered table-hover">
								<thead>
									<tr>
										<th class="center">
											<label>
											<input type="checkbox" class="ace" id="checkedAll"/>
											<span class="lbl"></span>
											</label>
										</th>
										
										<#list viewColList as vo>
										<#if (vo.name != 'id' && vo.name != 'created' && vo.name != 'modified' && vo.show && vo.name != 'cuid' && vo.name != 'muid')>
										<th>${vo.nameCN}</th>
										</#if>
										</#list>
										
										<th>创建时间</th>
										<th>修改时间</th>
										<th>操作</th>
									</tr>
								</thead>

								<tbody>
								<#noparse>
								<c:forEach var="vo" items="${pg.dataList}" varStatus="st">
								</#noparse>
									<tr>
										<td class="center">
											<label>
											<input type="checkbox" class="ace" name="ids" value="<#noparse>${vo.id}</#noparse>"/>
											<span class="lbl"></span>
											</label>
										</td>
										
										<#list viewColList as vo>
										<#if (vo.name != 'id' && vo.name != 'created' && vo.name != 'modified' && vo.show && vo.name != 'cuid' && vo.name != 'muid')>
										<td><#noparse>${vo.</#noparse>${vo.name}<#noparse>}</#noparse></td>
										</#if>
										</#list>
										
										<#noparse>
										<td>${s:fmtDate(vo.created)}</td>
										<td>${s:fmtDate(vo.modified)}</td>
										</#noparse>

										<td>
											<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
												<a href="<#noparse>${ctx}</#noparse>/${moduleUri}/${beanUri}_detail/<#noparse>${vo.id}</#noparse>"  class="btn btn-sm btn-primary">
													<i class="icon-zoom-in bigger-120"></i> 查看
												</a>
												<a href="<#noparse>${ctx}</#noparse>/${moduleUri}/${beanUri}_form?id=<#noparse>${vo.id}</#noparse>" class="btn btn-sm btn-success">
													<i class="icon-edit bigger-120"></i> 修改
												</a>
												<a href="javascript:void(0);" onclick="deleteById(<#noparse>${vo.id}</#noparse>)"  class="btn btn-sm btn-warning"> 
													<i class="icon-trash bigger-120"></i> 删除
												</a>
											</div>
										</td>
									</tr>
								<#noparse>
								</c:forEach>
								</#noparse>
								</tbody>
							</table>
							<%@ include file="/WEB-INF/view/jsp/common/pg_ace.jsp"%>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
</html>